package com.ruoyi.supply.enums;

import lombok.Getter;

/**
 * @author huangxiong
 * @date 2025/06/15 11:14
 */
@Getter
public enum MemberLogTypeEnum {

    /**
     *  查看货源
     *  购买货源
     *  查看地点
     *  购买地点
     *  购买会员
     *  退款
     */
    CHECK_SUPPLY(combineCode("1",MemberConsumeTypeEnum.SOURCE),"查看货源"),
    BUY_SUPPLY(combineCode("2",MemberConsumeTypeEnum.SOURCE),"购买货源"),
    CHECK_LOCATION(combineCode("1",MemberConsumeTypeEnum.LOCATION),"查看地点"),
    BUY_LOCATION(combineCode("2",MemberConsumeTypeEnum.LOCATION),"购买地点"),
    BUY_MEMBER(combineCode("1",MemberConsumeTypeEnum.GRADE),"购买会员"),
    REFUND("-1","退款");


    public final static String CHECK = "1";
    public final static String BUG= "2";
    public final static String RE_FUND="-1";


    private final String code;
    private final String desc;

    MemberLogTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private static String combineCode(String doType,MemberConsumeTypeEnum consumeTypeEnum){
        return doType+consumeTypeEnum.getCode();
    }

    public static MemberLogTypeEnum getByCode(String buyType) {
        for (MemberLogTypeEnum value : values()) {
            if (value.code.equals(buyType)) {
                return value;
            }
        }
        return null;
    }
}
